Skip to content

Experiment: Fluent theme#4761

Merged
mikewheaton merged 10 commits intomicrosoft:masterfrom
mikewheaton:miwhea/fluent-experiment
May 7, 2018
Merged

Experiment: Fluent theme#4761
mikewheaton merged 10 commits intomicrosoft:masterfrom
mikewheaton:miwhea/fluent-experiment

Conversation

@mikewheaton
Copy link
Contributor

@mikewheaton mikewheaton commented May 3, 2018

Pull request checklist

  • Addresses an existing issue: N/A
  • Include a change request file using $ npm run change

Description of changes

This PR adds a Fluent theme to the experiments package, as well as an example page showing how to use Customizer to apply this theme to a component. All of the Fluent colors are included in an object for reference by any theme.

Focus areas to test

  1. Run npm start from within /packages/experiments/
  2. Navigate to the FluentTheme example page
  3. Verify that the colors are different for the Fluent-themed components (the difference is very slight)

Screenshot

image

import { FluentColors } from "@uifabric/experiments/lib/components/fluent/theme/FluentColors";

const FluentTheme: ITheme = createTheme({
palette: {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be expanded over time, as all of the current colors (not just grays) have equivalents in the Fluent palette.

pink10: '#edbed3',

// Communication
communication90: '#004578',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just thinking out loud--I wonder if these palettes should be broken out as separate palette objects, e.g. CommunicationPalette, PowerPointPalette, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea. I've named then like CommunicationColors to distinguish between colors (the box of crayons) and a palette (a set of named slots that can be colored in).

@@ -0,0 +1,288 @@
export const FluentColors: any = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we supposed to have these product-specific things in Fabric?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of it myself, as it feels like it goes beyond the scope of Fabric as a shared design language. We're likely to add many more apps and color palettes over time, so there are concerns for bundle size (and all of the classes in Fabric Core) as well as maintaining this. I'll bring it up again when discussing Fluent with the designers.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've removed the app-specific colors, except for Communication as it covers multiple apps and we need default theme colors.

<a href="https://fluent.microsoft.com/">Fluent Design System</a>.
Before these colors become the defaults, this theme is provided as
a way to preview how the color changes will affect your app. Note
that theming requires components to be written using{" "}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't true, only contextual theming requires the use of mergeStyles.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for catching this. So <Customizer/> is used for contextual theming, and loadTheme() for theming the entire app?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated :)

mergeStyles
</a>, the Customizer component can be used to apply the theme. See
the examples below. For all other components (including your app's
custom components), use the loadTheme() function.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super nit: but might be useful to readers if we link loadTheme() to the actual implementation in source, https://github.com/OfficeDev/office-ui-fabric-react/blob/2ea373d0f35d2ebba56084455987f829e6e72188/packages/styling/src/styles/theme.ts#L80

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Added

@@ -0,0 +1,245 @@
/* tslint:disable:no-any */
export const GrayColors: any = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does out linter allow type 'any'? In any case, maybe [key: string]: string would be better.. marginally

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any is allowed here. :)

@mikewheaton mikewheaton merged commit ba51e2f into microsoft:master May 7, 2018
@mikewheaton mikewheaton deleted the miwhea/fluent-experiment branch May 7, 2018 17:24
@microsoft microsoft locked as resolved and limited conversation to collaborators Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

Comments